﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
using System.Reflection;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using Enterprise.Data.Dynamic;
using Enterprise.Core;
namespace Viewer.BusinessObject.BusinessEntities
{

    [Serializable()]
    public partial class NSToChuc : BusinessBase1<NSToChuc>
    {
        #region sonnh11
        //Override Primary Key
        public override int Id
        {
            get { return this.ToChucID; }
            set { this.ToChucID = value; }
        }

        /// <summary>
        /// Override method GetById
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public override NSToChuc GetByID(int id)
        {
            if (id < 1 ) return null;
            return this.CurrentTable.Where(string.Format("ToChucID = {0}", id)).FirstOrDefault();
        }

        public static NSToChuc GetById(int id)
        {
            return (new NSToChuc()).GetByID(id);
        }
       

        public override void SetUpdateValue(ref NSToChuc entity)
        {
            base.SetUpdateValue(ref entity);
            entity.TenToChucShort = this.TenToChucShort;
            entity.TenToChucFull = this.TenToChucShort;
            entity.GhiChu = this.GhiChu;
            entity.DiaChiID = this.DiaChiID;
            entity.KhoiQuanLyID = this.KhoiQuanLyID;
            entity.XepHangDonViID = this.XepHangDonViID;
            entity.DonViHanhChinhTrucThuocID = this.DonViHanhChinhTrucThuocID;
            entity.LoaiToChucID = this.LoaiToChucID;
        }
        #endregion
    }
}